# -*- coding: utf-8 -*-
import fasttext
from settings.path import *
import datetime
import os

if not os.path.exists(path_model):
    os.mkdir(path_model)

current_time = datetime.datetime.now().date().today().strftime("%Y%m%d")
model = fasttext.train_supervised(input=path_data_train_fasttext_processed_txt,
                                  autotuneValidationFile=path_test_txt,
                                  autotuneDuration=600,
                                  thread=100,
                                  verbose=3,
                                  autotuneModelSize='10M')  # 触发量化
model.save_model(path_fasttext_model)
res = model.predict("天下万般兵刃，唯有过往伤人最深")
print(res)
ress = model.test(path_data_test_fasttext_processed_txt)
print(ress)  # 1.测试样本数，2.准确率，3.召回率
